package com.brightworks.scripthelper.analyzers
{
    import com.brightworks.scripthelper.constants.LineTypeConstants;
    import com.brightworks.util.Log;
    import com.brightworks.util.Utils_String;

    public class LineTypeAnalyzer_Header_Level extends LineTypeAnalyzer
    {
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
        //
        //          Getters & Setters
        //
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

        public static function get lineTypeDescription():String
        {
            return LineTypeConstants.LINE_TYPE_DESCRIPTION__HEADER__LEVEL;
        }

        public static function get lineTypeId():String
        {
            return LineTypeConstants.LINE_TYPE_ID__HEADER__LEVEL;
        }

        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
        //
        //          Public Methods
        //
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

        public function LineTypeAnalyzer_Header_Level()
        {
            super();
        }

        public function getLevel():String
        {
            if (lineText.indexOf("Level: ") != 0)
                return "";
            var result:String = lineText.substring(7, lineText.length);
            result = Utils_String.removeWhiteSpaceIncludingLineReturnsFromBeginningAndEndOfString(result);
            return result;
        }

        override public function getProblemReports():Array
        {
            var problemList:Array = [];
            if (lineText.indexOf("Level: ") != 0)
            {
                problemList.push("Based on its position as the 9th line in the script, this line should be the " + LineTypeConstants.LINE_TYPE_DESCRIPTION__HEADER__LEVEL + ", but this doesn't seem to be the case.");
            }
            else
            {
                switch (getLevel())
                {
                    case "Introductory":
                    case "Beginner":
                    case "Intermediate":
                    case "Advanced":
                        break;
                    default:
                        problemList.push("Level is '" + getLevel() + "', which is not a standard level.");
                }
            }
            return constructFullProblemStrings(problemList);
        }

        public static function isLineThisType(lineString:String, lineStringList:Array=null, lineNum:int=-1):Boolean
        {
            // We use another, external, method to determine this at this point, so this method isn't used.
            Log.fatal("LineTypeAnalyzer_Header_Level.isLineThisType(): Method not implemented");
            return false;
        }

        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
        //
        //          Private Methods
        //
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

    }
}

